package ThreadedBinaryTree;

public class ThreadedBinaryTree {
    public static void main(String[] args){
        NodeOperate tree=new NodeOperate(1,"11");
        Node a=new Node(2,"22");
        Node b=new Node(3,"33");
        Node c=new Node(4,"44");
        Node d=new Node(5,"55");
        tree.headNode.setNextLeft(a);
        tree.headNode.setNextRight(b);
        tree.headNode.getNextRight().setNextLeft(c);
        tree.headNode.getNextRight().setNextRight(d);
        tree.preList(tree.headNode);
        System.out.println();
        tree.midList(tree.headNode);
        System.out.println();
        tree.afterList(tree.headNode);
        System.out.println();
        tree.preFindAndList(0,tree.headNode);
        tree.midFindAndList(2,tree.headNode);
        tree.afterFindAndList(5,tree.headNode);
        tree.deleteNode(0,tree.headNode);
        //tree.deleteNode(5,tree.headNode);
        tree.preList(tree.headNode);
        System.out.println();
        //tree.deleteNode(2,tree.headNode);
        tree.preList(tree.headNode);
        System.out.println();
        NodeOperate tree02=new NodeOperate(1,"11");
        Node a1=new Node(1,"11");
        Node b1=new Node(2,"22");
        Node c1=new Node(3,"33");
        Node d1=new Node(4,"44");
        Node e1=new Node(5,"55");
        Node f1=new Node(6,"66");
        Node g1=new Node(7,"77");
        Node h1=new Node(8,"88");
        Node i1=new Node(9,"99");
        Node j1=new Node(0,"00");
        Node arr[]={a1,b1,c1,d1,e1,f1,g1,h1,i1,j1};
        for(int n=1;n<=arr.length;n++){
            tree02.storageArr(arr,n);
        }
        tree.midList(tree02.headNode);
        System.out.println();

        tree.threadedTree(tree02.headNode);
        tree.threadedList(tree02.headNode);
    }

}
